<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Source: sign_in.js</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Source: sign_in.js</h1>

    



    
    <section>
        <article>
            <pre class="prettyprint source linenums"><code>/** @file  Sign in form for a user to enter their LabelMe username. */

// This code is very complex for what it is doing.
// Needs optimization
//
// PlaceSignInHTML() is complex. Needs to make more explicit all the elements.


function initUserName() {
    // The first time we get the username will give preference to the username passed
    //   in the URL as it might come from the LabelMe browser.
    username = getQueryVariable("username");

    if (!username || (username.length==0)) {
        username = getCookie("username");
        if (!username || (username.length==0)) {
            username = "anonymous";
        }
    }
    
    if (username=="null") {username = "anonymous";}
    
    setCookie("username",username);
    $("#usernametxt").text(username);
}

function show_enterUserNameDIV() {
    // This function simply swaps the divs to show the "changeAndDisplayUserName" div
    $("#display_user").hide();
    $("#enterUserName").show();
    // put the cursor inside the text box
    document.getElementById('userEnter').focus();
    document.getElementById('userEnter').select();

    return false;
}

function changeAndDisplayUserName(c) {
    // Shows the entered name.
    // c is the key that produced getting out of the text box.
    // only change the username is the user pressed "enter" -> c==13
    if (c==13){
        username = $("#userEnter").val();
    
        if (username.length==0) {
            username = getCookie("username");
        }   
    
        setCookie("username",username);
        $("#usernametxt").text(username);
    }

    $("#display_user").show();
    $("#enterUserName").hide();
}
</code></pre>
        </article>
    </section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AdjustEvent.html">AdjustEvent</a></li><li><a href="canvas.html">canvas</a></li><li><a href="file_info.html">file_info</a></li><li><a href="image.html">image</a></li></ul><h3>Global</h3><ul><li><a href="global.html#AdjustPolygonButton">AdjustPolygonButton</a></li><li><a href="global.html#CreatePopupBubble">CreatePopupBubble</a></li><li><a href="global.html#CreatePopupBubbleCloseButton">CreatePopupBubbleCloseButton</a></li><li><a href="global.html#DrawCanvasClosePolygon">DrawCanvasClosePolygon</a></li><li><a href="global.html#DrawCanvasMouseDown">DrawCanvasMouseDown</a></li><li><a href="global.html#FinishStartup">FinishStartup</a></li><li><a href="global.html#getQueryVariable">getQueryVariable</a></li><li><a href="global.html#LMgetObjectField">LMgetObjectField</a></li><li><a href="global.html#LMnumberOfObjects">LMnumberOfObjects</a></li><li><a href="global.html#LoadAnnotation404">LoadAnnotation404</a></li><li><a href="global.html#LoadAnnotationSuccess">LoadAnnotationSuccess</a></li><li><a href="global.html#LoadTemplate404">LoadTemplate404</a></li><li><a href="global.html#LoadTemplateSuccess">LoadTemplateSuccess</a></li><li><a href="global.html#SetAllAnnotationsArray">SetAllAnnotationsArray</a></li><li><a href="global.html#StartDrawEvent">StartDrawEvent</a></li><li><a href="global.html#StartEditEvent">StartEditEvent</a></li><li><a href="global.html#StartEditVideoEvent">StartEditVideoEvent</a></li><li><a href="global.html#StartupLabelMe">StartupLabelMe</a></li><li><a href="global.html#StopDrawEvent">StopDrawEvent</a></li><li><a href="global.html#StopEditEvent">StopEditEvent</a></li><li><a href="global.html#UndoCloseButton">UndoCloseButton</a></li></ul>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0-dev</a> on Thu Mar 12 2015 16:00:31 GMT-0700 (PDT)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
